import { createRouter, createWebHistory } from 'vue-router'
import { titleController } from '@/utils'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      component: () => import('./index.vue'),
      meta: {
        title: '首页'
      }
    }
  ]
})
router.afterEach((to) => {
  if (to.meta.title) {
    titleController.setRouteTitle(to.meta.title)
  }
})
export default router
